// import {lazy} from 'react'

import Fallback from './components/Fallback'
import Dashboard from './pages/Dashboard'
import Relationship from './pages/Relationship'
import AccountEvent from './pages/AccountEvent'
import AccountItem from './pages/AccountItem'

/**
 * 懒加载报错：
 * Functions are not valid as a React child. This may happen if you 
 * return a Component instead of <Component /> from render. Or maybe 
 * you meant to call this function rather than return it.
 */
// const Relationship = lazy(() => import('./pages/Relationship'))
// const AccountEvent = lazy(() => import('./pages/AccountEvent'))
// const AccountItem = lazy(() => import('./pages/AccountItem'))

const router = {
  routes: [
    {
      name: '控制面板',
      icon: 'DashboardOutlined',
      path: '/dashboard',
      component: Dashboard,
    },
    {
      name: '关系管理',
      icon: 'BranchesOutlined',
      path: '/relationship',
      component: Relationship,
    },
    {
      name: '事件管理',
      icon: 'NumberOutlined',
      path: '/event',
      component: AccountEvent,
    },
    {
      name: '账目管理',
      icon: 'PayCircleOutlined',
      path: '/items',
      component: AccountItem,
    }
  ],
  fallback: Fallback,
  default: '/dashboard'
}

export default router